<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="webroot" value="${pageContext.request.contextPath}" />
<script type="text/javascript"
	src="${webroot}/static/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript"
	src="${webroot}/static/js/bootstrap.min.js"></script>
<script type="text/javascript"
	src="${webroot}/static/js/bootstrap-table.js"></script>
<script type="text/javascript"
	src="${webroot}/static/js/app-common-2.00.0.js"></script>
<script type="text/javascript" src="${webroot}/static/js/layer/layer.js"></script>
<script src="${webroot}/static/js/jquery.form.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
	href="${webroot}/static/js/layer/skin/layer.css" />
<link rel="stylesheet" type="text/css"
	href="${webroot}/static/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css"
	href="${webroot}/static/css/bootstrap-table.min.css" />
<link rel="stylesheet" type="text/css" href="${webroot}/static/css/forms.css" />
<html lang="en">
<head>
<style type="text/css">
label {
    width: 80px;
}
.table>tbody>tr>td, .table>tfoot>tr>td {
    text-align: center;
    vertical-align: middle;
}
</style>
</head>
<body>
	<div>
		<form class="order-form" id="filterForm">
			<input type="hidden" id="fh" name="fh" /> <input type="hidden"
				id="hf" name="hf" />
			<div class="control-group clearfix">
				<label>在线时长:</label>
				<div class="control">
					<input type="text" class="control-input" id="startDurationNum" id="startDurationNum">-
					<input type="text" class="control-input" id="endDurationNum" id="endDurationNum">
				</div>
			</div>
			<div class="control-group clearfix">
				<label>打开次数:</label>
				<div class="control">
					<input type="text" class="control-input" id="startOpenCount" id="startOpenCount">-
					<input type="text" class="control-input" id="endOpenCount" id="endOpenCount">
				</div>
			</div>
			<div class="control-group clearfix" style="width: 15%;">
				<label>手机号:</label>
				<div class="control">
					<input type="text" class="control-input" id="phone" id="phone">
				</div>
			</div>
			<div class="control-group clearfix" style="width: 15%;">
				<div class="control">
				   <input type="button" value="查询" id="btn_query" class="layui-btn layui-btn-sm layui-btn-normal"/>&nbsp;
			       <input type="button" value="重置" id="btn_reunion" class="layui-btn layui-btn-sm layui-btn-danger"/>
				</div>
			</div>
		</form>
		<div style="position: relative; top: -11px; height: 38px;">
			<button class="layui-btn" onclick="statistics(1);">在线时长统计表</button>
			<button class="layui-btn" onclick="statistics(2);">打开次数统计表</button>
		</div>
		<form id='dictGridDiv'></form>
		<div id="main" style="width: 600px;height:400px;"></div>
	</div>
</body>
<script type="text/javascript" src="${webroot}/static/js/echarts.min.js"></script>
<script type="text/javascript">

/* 	var list = JSON.parse('${gpLists}');
	for (var i = 0; i < list.length; i++) {
		if (list[i].resourceName == "封号") {
			$("#fh").val("1");
		}
		if (list[i].resourceName == "恢复") {
			$("#hf").val("1");
		}
	}  */
	$(function() {
		//1.初始化Table
		var oTable = new TableInit();
		oTable.Init();
		$("#btn_query").click(function() {
			$("#dictGridDiv").bootstrapTable('destroy');
			var oTable = new TableInit();
			oTable.Init();
		});
		$("#btn_reunion").click(function() {
			$("#startDurationNum").val("");
			$("#endDurationNum").val("");
			$("#startOpenCount").val("");
			$("#endOpenCount").val("");
			$("#phone").val("");
			$("#dictGridDiv").bootstrapTable('destroy');
			var oTable = new TableInit();
			oTable.Init();
		});
	});
	var TableInit = function() {
		var oTableInit = new Object();
		//初始化Table
		oTableInit.Init = function() {
			$('#dictGridDiv')
					.bootstrapTable(
							{
								url : '${webroot}/useremploy/querypage',
								dataType : "json",
								toolbar : '#toolbar', //工具按钮用哪个容器
								striped : true, //是否显示行间隔色
								singleSelect : false,
								pagination : true, //分页
								pageNumber : 1, //初始化加载第一页，默认第一页
								queryParams : queryParams,
								pageSize : 10, //每页的记录行数（*）
								pageList : false, //可供选择的每页的行数（*）
								//search: true, //显示搜索框
								sidePagination : "server", //服务端处理分页
								columns : [
										{
											field : 'seqon',
											title : '序号',
											align : 'center',
											width : '90'

										},
										{
											field : 'phone',
											title : '手机号',
											align : 'center',
											width : '200'
										},
										{
											field : 'nickname',
											title : '昵称',
											align : 'center',
											width : '300'
										},
										{
											field : 'durationNum',
											title : '在线时长',
											align : 'center',
											width : '280'
										},
										{
											field : 'openCount',
											title : '打开次数',
											align : 'center',
											width : '200'
										},
										{
											field : 'sigCount',
											title : '签到次数',
											align : 'center',
											width : '200'
										},	
										{
											field : 'area',
											title : '地区',
											align : 'center',
											width : '630'
										} ]
							});
		};
		function queryParams(params) {
			return {
				pageSize : params.limit, //页面大小
				pageNumber : params.offset, //页码
				startDurationNum : $("#startDurationNum").val(),
				endDurationNum : $("#endDurationNum").val(),
				startOpenCount : $("#startOpenCount").val(),
				endOpenCount : $("#endOpenCount").val(),
				phone : $("#phone").val(),
			};
		}
		return oTableInit;
	};
	
	function statistics(i){
		var title = ''; var url ='';
		if(i == 1){
			title = '在线时长统计';
			url ='${webroot}/useremploy/duration';
		}else{
			title = '打开次数统计';
			url ='${webroot}/useremploy/frequency';
		}
		var layerIndex = layer.open({
			type : 2,
			shade : [0.3,'#000'],
			fix : false,
			title : title,
			maxmin : true,
			Method : "POST",
			content :url,
			area : [ '650px', '450px' ],
			end : function(index) {
				//刷新页面
			}
		});
	}
</script>
</html>